{extend name="iframe" /}
{block name="body"}
<div>
	<ul class="layui-nav" lay-filter="">
		<li class="layui-nav-item"><a onclick="clickInfo()">基本信息</a></li>
		<li class="layui-nav-item layui-this"><a onclick="clickResume()">履历</a></li>
		<li class="layui-nav-item"><a onclick="clickReward()">奖惩信息</a></li>
	</ul>
</div>
<div class="layui-card">
	<div class="layui-card-body">
		<input type="hidden" id="id" name="id" value="{$id|default=''}" />
		<input type="hidden" id="kid" name="kid" value="{$kid|default=''}" />
        <div class="layui-btn-group">
			<a onclick="resumeAdd()" class="layui-btn"><i class="fa fa-plus-circle"></i> 添加履历</a>
        </div>
		<table class="layui-table layui-form">
			<thead>
			<tr>
				<th>年份</th>
				<th>机构</th>
				<th>学历</th>
				<th>邮箱</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{foreach name="list" item="v" empty="$empty"}
			<tr>
				<td>{$v.year_from} 到 {$v.year_to}</td>
				<td>{$v.agency}</td>
				<td>{$v.education}</td>
				<td>{$v.email}</td>
				<td>
					<a onclick="resumeEdit({$v.id})" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> 编辑</a>
					<a href="{:url('admin/scholar/resumeDel', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
				</td>
			</tr>
			{/foreach}
			</tbody>
		</table>
		<div class="page">{$list->render()}</div>
	</div>
</div>
{/block}
{block name="js"}
<script>
	function clickInfo() {
		var id = $('#id').val();
		var kid = $('#kid').val();
		location.href = '/admin/scholar/edit?id=' + id + '&kid=' + kid
	}

	function clickResume() {
		var id = $('#id').val();
		var kid = $('#kid').val();
		location.href = '/admin/scholar/resumeDetail?id=' + id + '&kid=' + kid
	}

	function clickReward() {
		var id = $('#id').val();
		var kid = $('#kid').val();
		location.href = '/admin/scholar/toRewardAndPunish?id=' + id + '&kid=' + kid
	}

	function resumeAdd() {
		var kid = $("#kid").val();
		if (kid === '' || kid === null || kid === undefined) {
			layer.msg("该学员编号不存在");
		}
		layer.open({
			type: 2,
			title: '履历',
			shadeClose: true,
			shade: false,
			area: ['420px', '520px'],
			content: '/admin/scholar/resumeAdd?kid=' + kid,
		});
	}

	function resumeEdit(data) {
		layer.open({
			type: 2,
			title: '履历',
			shadeClose: true,
			shade: false,
			area: ['420px', '520px'],
			content: '/admin/scholar/resumeEdit?id=' + data,
		});
	}
</script>
{/block}